package com.gzc.pm.dao;

import java.util.HashMap;
import java.util.List;

import com.gzc.pm.bean.CollectionBean;

import cn.skyclass.ibatis.IBatisDao;
import cn.skyclass.net.OperationResult;

public class CollectionDao {

	private IBatisDao dao = new IBatisDao();
	
	@SuppressWarnings("unchecked")
	public List<CollectionBean> getInEquCodes(String equCodesStr, String sDateStr, String eDateStr){
		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("equCodesStr", equCodesStr);
		map.put("sDateStr", sDateStr);
		map.put("eDateStr", eDateStr);
		
		List<CollectionBean> list1 = dao.getList("Collections.getInEquCodes", map);
//		//TODO:临时
//		if(equCodesStr.indexOf("Baa0")>=0){
//			List<CollectionBean> list2 = dao.getList("Collections.getInEquCodes2", map);
//			if(list2 != null) list1.addAll(list2);
//		}
		return list1;
	}
	
	@SuppressWarnings("unchecked")
	public List<CollectionBean> getInEquId(int equId, String sDateStr, String eDateStr){
		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("equId", equId);
		map.put("sDateStr", sDateStr);
		map.put("eDateStr", eDateStr);
		
		List<CollectionBean> list = dao.getList("Collections.getInEquId", map);
		return list;
	}
	
	@SuppressWarnings("unchecked")
	public List<CollectionBean> getInEquIds(String equCodesStr, String sDateStr, String eDateStr){
		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("equCodesStr", equCodesStr);
		map.put("sDateStr", sDateStr);
		map.put("eDateStr", eDateStr);
		
		List<CollectionBean> list = dao.getList("Collections.getInEquIds", map);
		return list;
	}
	
	@SuppressWarnings("unchecked")
	public List<CollectionBean> getInCpk(int procId, String sDateStr, String eDateStr){
		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("procId", procId);
		map.put("sDateStr", sDateStr);
		map.put("eDateStr", eDateStr);
		
		List<CollectionBean> list = dao.getList("Collections.getInCpk", map);
		return list;
	}
	
	
	public OperationResult insert(CollectionBean bean){
		return dao.executeInsert("Collections.insert", bean);
	}
}
